#include<iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
bool is_eq;
// 1st
int arr[n];
int i;
for(i=0;i<n;i++)
{
cin>>arr[i];
}
int count[9];
for(i=0;i<9;i++)
{
count[i] = 0;
}
for(i=0;i<n;i++)
{
int ix = arr[i] - 1;
count[ix]++;
}
cout<<"- "<<0<<endl;
fflush(stdout); cout.flush();
// 2nd and third
int count_new[9];
REDO: for(i=0;i<n;i++)
{
cin>>arr[i];
}
for(i=0;i<9;i++)
{
count_new[i] = 0;
}
for(i=0;i<n;i++)
{
int ix = arr[i] - 1;
count_new[ix]++;
}
is_eq = true;
for(i=0;i<9;i++)
{
if(count[i]!=count_new[i])
{
is_eq = false;
}
}
if(is_eq)
{
cout<<"- "<<0<<endl;
fflush(stdout); cout.flush();
goto REDO;
}
// They are uneq
int his_ix;
for(i=0;i<9;i++)
{
if(count_new[i]>count[i])
{
his_ix = i;
}
}
int remove = 0;
for(i=0;i<n;i++)
{
int x = arr[i] - 1;
if(x!=his_ix)
{
remove++;
}
}
// cout<<"His Ix is"<<his_ix<<endl;
// for(i=0;i<9;i++)
// {
// cout<<count[i]<<" ";
// }
// cout<<endl;
// for(i=0;i<9;i++)
// {
// cout<<count_new[i]<<" ";
// }
// cout<<endl;
cout<<"- "<<remove<<" ";
for(i=0;i<n;i++)
{
int x = arr[i] - 1;
if(x!=his_ix)
{
cout<<i+1<<" ";
count_new[x]--;
}
}
cout<<endl;
n-=remove;
// cout<<"N is upd to "<<n<<endl;
fflush(stdout); cout.flush();
for(i=0;i<9;i++)
{
count[i] = count_new[i];
}
// New lap
// cout<<"New Lap"<<endl;
REDO1: for(i=0;i<n;i++)
{
// cout<<"Hi5";
cin>>arr[i];
}
for(i=0;i<9;i++)
{
// cout<<"Hi4";
count_new[i] = 0;
}
for(i=0;i<n;i++)
{
// cout<<"Hi3";
int ix = arr[i] - 1;
count_new[ix]++;
}
is_eq = true;
for(i=0;i<9;i++)
{
// cout<<"Hi2";
if(count[i]!=count_new[i])
{
is_eq = false;
}
}
if(is_eq)
{
// cout<<"Hi1";
cout<<"- "<<0<<endl;
fflush(stdout); cout.flush();
goto REDO1;
}
// Now un
// for(i=0;i<n;i++)
// {
// cin>>arr[i];
// }
his_ix++;
for(i=0;i<n;i++)
{
if(arr[i]!=his_ix)
{
cout<<"! "<<i+1<<endl;
fflush(stdout); cout.flush();
}
}
}
}
1822. Sign of the Product of an Array | 1464. Maximum Product of Two Elements in an Array |
1323. Maximum 69 Number | 832. Flipping an Image |
1295. Find Numbers with Even Number of Digits | 1704. Determine if String Halves Are Alike |
1732. Find the Highest Altitude | 709. To Lower Case |
1688. Count of Matches in Tournament | 1684. Count the Number of Consistent Strings |
1588. Sum of All Odd Length Subarrays | 1662. Check If Two String Arrays are Equivalent |
1832. Check if the Sentence Is Pangram | 1678. Goal Parser Interpretation |
1389. Create Target Array in the Given Order | 1313. Decompress Run-Length Encoded List |
1281. Subtract the Product and Sum of Digits of an Integer | 1342. Number of Steps to Reduce a Number to Zero |
1528. Shuffle String | 1365. How Many Numbers Are Smaller Than the Current Number |
771. Jewels and Stones | 1512. Number of Good Pairs |
672. Richest Customer Wealth | 1470. Shuffle the Array |
1431. Kids With the Greatest Number of Candies | 1480. Running Sum of 1d Array |
682. Baseball Game | 496. Next Greater Element I |
232. Implement Queue using Stacks | 844. Backspace String Compare |